import qs from 'qs'
export default {
    name: "Personaltailor",
    components: {},
    data() {
        return {
            cloudShow: '10G',
            List: [
                {
                    label: "10G",
                    name: "10G"
                },
                {
                    label: "20G",
                    name: "20G"
                },
                {
                    label: "50G",
                    name: "50G"
                },
                {
                    label: "100G",
                    name: "100G"
                },
                {
                    label: "200G",
                    name: "200G"
                },
                {
                    label: "500G",
                    name: "500G"
                },
                {
                    label: "1000G",
                    name: "1000G"
                }
            ],
            cloudShow2: "10个",
            List2: [
                {
                    label: "10个",
                    name: '10个'
                },
                {
                    label: "20个",
                    name: "20个"
                },
                {
                    label: "50个",
                    name: "50个"
                },
                {
                    label: "100个",
                    name: "100个"
                },
                {
                    label: "200个",
                    name: "200个"
                },
                {
                    label: "500个",
                    name: "500个"
                },
                {
                    label: "1000个",
                    name: "1000个"
                }
            ],
            cloudShow3: "1M",
            List3: [
                {
                    label: "1M",
                    name: "1M"
                },
                {
                    label: "2M",
                    name: "2M"
                },
                {
                    label: "4M",
                    name: "4M"
                },
                {
                    label: "6M",
                    name: "6M"
                },
                {
                    label: "8M",
                    name: "8M"
                },
                {
                    label: "10M",
                    name: "10M"
                },
                {
                    label: "12M",
                    name: "12M"
                },
                {
                    label: "20M",
                    name: "20M"
                },
                {
                    label: "50M",
                    name: "50M"
                }
            ],
            cloudShow4: "0.5年",
            List4: [
                {
                    label: "0.5年",
                    name: "0.5年"
                },
                {
                    label: "1年",
                    name: "1年"
                },
                {
                    label: "2年",
                    name: "2年"
                },
                {
                    label: "3年",
                    name: "3年"
                },
                {
                    label: "4年",
                    name: "4年"
                },
                {
                    label: "5年",
                    name: "5年"
                }
            ],
            money:1,
            cloudtitleupgrade: "云盘空间升级",
            deviceCountupgrade: "设备数量升级",
            bandwidthUpgrade: "带宽升级",
            lifetimeupgrade: "使用年限升级",
            users:""
        };
    },
    computed: {},
    watch: {},
    created() {
        this.users = JSON.parse(window.localStorage.getItem("userInfo"));
     },
    mounted() { },
    methods: {
        payClickBtn(){
            var postData = [];
            postData.push({
                cloudtitleupgrade:this.cloudtitleupgrade,
                cloudShow:this.cloudShow,
            },
            {
                cloudtitleupgrade:this.deviceCountupgrade,
                cloudShow:this.cloudShow2,
            },
            {
                cloudtitleupgrade:this.bandwidthUpgrade,
                cloudShow:this.cloudShow3,
            },
            {
                cloudtitleupgrade:this.lifetimeupgrade,
                cloudShow:this.cloudShow4
            });
            var txtData = {
                productName: this.cloudtitleupgrade,
                describe:this.cloudShow,
                price:this.money,
                userId:this.users.uId
            }
            this.$http.post('/orderController/addOrder',qs.stringify(txtData))
            .then((res) => {
               if(res.status == 200){
                  this.$message({
                      type:"success",
                      message:"添加订单成功"
                  });
                  this.orderNumber = res.data.orderNumber;
                  this.$router.push({
                    name: "Personaorderdetail",
                    params: {
                        cloudtitleupgrade: postData,
                        money: this.money,
                        orderNumber: this.orderNumber,
                     }
                  });
                }
              }).catch((err) => {
                 console.log(err);
            });
        }
    }
};